//
//  WithdrawRecordCell.m
//  NoNeedle
//
//  Created by Ming Tian on 2017/3/20.
//  Copyright © 2017年 Ming Tian. All rights reserved.
//

#import "WithdrawRecordCell.h"

@implementation WithdrawRecordCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self) {
        [self setupSubviews];
    }
    return self;
}

- (void)setupSubviews {
    self.titleLabel = [[UILabel alloc]init];
    self.timeLabel = [[UILabel alloc]init];
    self.contentLabel = [[UILabel alloc]init];
    self.viewLine  = [[UIView alloc] init];
    
    self.titleLabel.font = [UIFont systemFontOfSize:15];
    self.titleLabel.textColor = RGB(0x333333);
    
    self.timeLabel.font = [UIFont systemFontOfSize:14];
    self.timeLabel.textColor = RGB(0x999999);
    
    self.contentLabel.font = [UIFont systemFontOfSize:15];
    self.contentLabel.textColor = strColor(@"ff7900");
    self.contentLabel.textAlignment = NSTextAlignmentRight;
    
    self.separatorInset = UIEdgeInsetsMake(0, 10, 0, 0);
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    self.viewLine .backgroundColor = [UIColor colorWithHexString:@"#e5e5e5"];
    
    [self addSubview:self.titleLabel];
    [self addSubview:self.timeLabel];
    [self addSubview:self.contentLabel];
    [self addSubview:self.viewLine];
    
    [self setupConstraints];
}

- (void)setupConstraints {
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(10);
        make.left.equalTo(self).offset(10);
    }];
    
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleLabel.mas_bottom).offset(8);
        make.left.equalTo(self.titleLabel);
    }];
    
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.right.equalTo(self).offset(-10);
    }];
    
    [self.viewLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(@0);
        make.height.equalTo(@0.5);
    }];
}

@end
